import request from "@/utils/request_oil";

// 获取商品分页列表
export function getCommodityListApi(commodity = {}) {
  return request({
    url: `/commodity/list?pageNum=${commodity.pageNum}&pageSize=${commodity.pageSize}`,
    method: "post",
    data: commodity,
  });
}

// 添加商品
export function addCommodityInfoApi(commodity) {
  return request({
    url: "/commodity/add",
    method: "post",
    data: commodity,
  });
}

// 编辑商品
export function editCommodityInfoApi(commodity) {
  return request({
    url: "/commodity/edit",
    method: "post",
    data: commodity,
  });
}

// 批量删除商品
export function pathDeleteCommodityApi(ids) {
  return request({
    url: "/commodity/delete",
    method: "post",
    data: ids,
  });
}

// 商品上架
export function putAwayCommodityApi(commodity) {
  return request({
    url: "/commodity/putAway",
    method: "post",
    data: commodity,
  });
}

// POST /nonMarket/activity/list 查看促销活动列表
export function activityList(ids) {
  return request({
    url: "/nonMarket/activity/list",
    method: "post",
    data: ids,
  });
}

// POST /nonMarket/activity/add 新增促销活动
export function activityAdd(ids) {
  return request({
    url: "/nonMarket/activity/add",
    method: "post",
    data: ids,
  });
}

// GET /nonMarket/activity/delete 删除促销活动
export function activityDelete(query) {
  return request({
    url: "/nonMarket/activity/delete",
    method: "get",
    params: query,
  });
}

// POST /nonMarket/activity/start 启用停止促销活动
export function activityStart(ids) {
  return request({
    url: "/nonMarket/activity/start",
    method: "post",
    data: ids,
  });
}

// POST /nonMarket/activity/update 修改促销活动
export function activityUpdate(ids) {
  return request({
    url: "/nonMarket/activity/update",
    method: "post",
    data: ids,
  });
}

// POST /Inventory/batch/list 查询库存盘点;
export function batchList(ids) {
  return request({
    url: "/Inventory/batch/list",
    method: "post",
    data: ids,
  });
}

// POST /Inventory/batch/export 导出库存盘点
export function batchExport(ids) {
  return request({
    url: "/Inventory/batch/export",
    method: "post",
    data: ids,
  });
}

// GET /Inventory/details/list 查询盘点商品详情列表;
export function detailsList(query) {
  return request({
    url: `/Inventory/details/list?batchId=${query}`,
    method: "get",
  });
}

// POST /Inventory/batch/save 新增库存盘点
export function batchSave(ids) {
  return request({
    url: "/Inventory/batch/save",
    method: "post",
    data: ids,
  });
}
